package sword.T53;

/**
 * @Author: 18362
 * @Create: 2022-04-10 0:08:43 星期日
 */
public class Solution2 {
    public int missingNumber(int[] nums) {
        int left = 0, right = nums.length-1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (nums[mid] == mid)
                left = mid + 1;
            else
                right = mid;
        }
        return nums[left] == left ? left + 1 : left;
    }
}
